/*
 * @Description:
 * @Author: owen
 * @Date: 2021-03-31 19:54:20
 * @LastEditTime: 2023-01-14 22:23:33
 */
import { optObject } from '../config'
import { isObject } from '@/utils/tools'
import { has, curry } from 'ramda'
function isRableSlotScope(arg: any): arg is Rantion.RableSlotScope {
	return isObject(arg)
}
type Key = string | number | Rantion.RableSlotScope

export const configFilter = (prop: string, key: Key) => {
	if (isRableSlotScope(key)) {
		key = key.text
	}
	if (has(prop, optObject)) {
		return optObject[prop][key as string]
	}
	return key
}

export const configCurryFilter = curry(configFilter)
